export function getCookie(key) {
  const cookieMap = document.cookie
    .split(';')
    .map((n) => n.trim())
    .reduce((prev, curr) => {
      const index = curr.indexOf('=')
      const key = curr.slice(0, index)
      const value = curr.slice(index + 1, curr.length)
      prev[key] = value
      return prev
    }, {})
  return cookieMap[key]
}
